package com.gsafety.library.common;

import android.widget.CompoundButton;

import androidx.annotation.NonNull;

import com.gsafety.library.R;

public abstract class OnBlockCheckedChangeListener implements CompoundButton.OnCheckedChangeListener
{
    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked)
    {
        Object tag = buttonView.getTag(R.id.checkbox_invoke_flag);
        boolean checkbox_invoke_flag = tag == null || (boolean) tag;
        buttonView.setTag(R.id.checkbox_invoke_flag, null);
        if (checkbox_invoke_flag)
        {
            onChanged(buttonView, isChecked);
        }
    }
    
    public abstract void onChanged(@NonNull CompoundButton buttonView, boolean isChecked);
}
